package com.ivan.lightcontrollerdemo;

public class UtilPaser {
	public static String replace(int start, int end, String str, int progress) {
		String hexStr = Integer.toHexString(progress);
		char[] arr = str.toCharArray();
		if (hexStr.length() == 2) {
			char firstChar = hexStr.charAt(0);
			char secondChar = hexStr.charAt(1);
			arr[start] = firstChar;
			arr[end] = secondChar;
			String.valueOf(arr);
			return String.valueOf(arr);

		} else {
			char c = hexStr.charAt(0);
			arr[start]='0';
			arr[end]=c;
			return String.valueOf(arr);
		}

	}
}
